package com.example.learn_vpn;

import java.net.InetAddress;


/**
 * ARP 表项。记录 MAC 与 IPv4 地址的对应关系及记录时间
 */
public class ARPEntry {
    private final long mac;
    private final InetAddress address;

    public long getMac() {
        return mac;
    }

    public InetAddress getAddress() {
        return address;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public ARPEntry(long mac, InetAddress address, long time) {
        this.mac = mac;
        this.address = address;
        this.time = time;
    }

    private long time;

    ARPEntry(long mac, InetAddress inetAddress) {
        this.mac = mac;
        this.address = inetAddress;
        updateTime();
    }

    public void updateTime() {
        this.time = System.currentTimeMillis();
    }
}
